package com.campus.notice.controller;

import com.campus.common.result.Result;
import com.campus.notice.service.IMessageService;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/message")
@Tag(name = "消息服务")
public class MessageController {

    @Autowired
    private IMessageService messageService;

    @ApiOperation(value = "考试安排消息发送")
    @GetMapping("/arrange-examination/{courseId}/{content}")
    public Result arrangeExamination(@PathVariable("courseId") int courseId, @PathVariable("content") String content) {
        return messageService.arrangeExamination(courseId, content);
    }

    @ApiOperation(value = "学生获取所有消息")
    @GetMapping("/stu-get-messages")
    public Result stuGetMessages() {
        return messageService.stuGetAllMessage();
    }

    @ApiOperation(value = "学生删除消息")
    @GetMapping("/stu-delete-messages/{messageId}")
    public Result stuDeleteMessages(@PathVariable("messageId") int messageId) {
        return messageService.stuDeleteMessage(messageId);
    }
}
